#ifndef _CYCLE_QUEUE_H_
#define _CYCLE_QUEUE_H_

typedef struct _CYCLE_QUEUE_s_ 
{
	UINT8 **ppBase;		
	UINT16 front;              //cycle queue head
	UINT16 rear;               //cycle queue tail
	UINT16 maxsize;            //cycle max size
	UINT16 elesize;            //cycle element size
}CYCLE_QUEUE_s,*PQUEUE;

extern ULONG CycleQueue_Create(IN INT32 iQSize, IN INT32 iESize,
                                       INOUT CYCLE_QUEUE_s **ppstQ);
extern BOOL CycleQueue_isFull(IN CYCLE_QUEUE_s *Q);
extern BOOL CycleQueue_isEmpty(IN CYCLE_QUEUE_s * Q);
extern ULONG CycleQueue_Enqueue(IN CYCLE_QUEUE_s * Q, IN UINT8 *val, 
                                        IN UINT16 uslen);
extern ULONG CycleQueue_GetHead(IN CYCLE_QUEUE_s * Q, INOUT UINT8 *val, 
                                        OUT UINT16 *pusLen);
extern ULONG CycleQueue_GetNext(IN CYCLE_QUEUE_s * Q, INOUT UINT8 *val, 
                                        OUT UINT16 *pusLen);
extern ULONG CycleQueue_Dequeue(IN CYCLE_QUEUE_s * Q, INOUT UINT8 *val, 
                                        OUT UINT16 *pusLen);
extern void CycleQueue_destory(INOUT CYCLE_QUEUE_s **ppstQ);

#endif

